Change in openvpn[release/2.6]: Harden interactive service pipe
A message that is not in the archive (sent off-list or not yet received): gerrit.1764008169000.Ie66a142751354e421d48b273784fc79bcb9f7208@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1401?usp=email
to review the following change.
Change subject: Harden interactive service pipe
......................................................................
Harden interactive service pipe
- Append a version 4 uuid to ovpn_pipe_name to make it less predictable
- Do not allow remote access to the pipe
This greatly reduces the possibility of a rogue process racing to open the pipe before CreateFile() is called in the worker thread.
---
M src/openvpnserv/interactive.c
1 file changed, 21 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/01/1401/1
src/openvpnserv/interactive.c +21 -2
@@ -1955,11 +1955,30 @@ goto out; } +UUID pipe_uuid; +RPC_STATUS rpc_stat =UuidCreate (&pipe_uuid); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidCreate" ,1 , &exit_event); + goto out; + } + +RPC_WSTR pipe_uuid_str =NULL ; + rpc_stat =UuidToStringW (&pipe_uuid, &pipe_uuid_str); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidToString" ,1 , &exit_event); + goto out; + }openvpn_swprintf (ovpn_pipe_name,_countof (ovpn_pipe_name), -TEXT ("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu" ), service_instance,GetCurrentThreadId ()); +TEXT ("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu_%ls" ), service_instance, +GetCurrentThreadId (), pipe_uuid_str); +RpcStringFree (&pipe_uuid_str); + ovpn_pipe =CreateNamedPipe (ovpn_pipe_name,PIPE_ACCESS_DUPLEX |FILE_FLAG_FIRST_PIPE_INSTANCE |FILE_FLAG_OVERLAPPED , -PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT ,1 ,128 ,128 ,0 ,NULL ); +PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT |PIPE_REJECT_REMOTE_CLIENTS , +1 ,128 ,128 ,0 ,NULL );if (ovpn_pipe ==INVALID_HANDLE_VALUE ) {ReturnLastError (pipe,L"CreateNamedPipe" );
Signature · 13 lines
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1401?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: Ie66a142751354e421d48b273784fc79bcb9f7208 Gerrit-Change-Number: 1401 Gerrit-PatchSet: 1 Gerrit-Owner: selvanair <[email protected]...> Gerrit-Reviewer: plaisthos <[email protected]...> Gerrit-CC: openvpn-devel <[email protected]> Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos, selvanair, stipa.
cron2 has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1401?usp=email )
Change subject: Harden interactive service pipe
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1401?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: Ie66a142751354e421d48b273784fc79bcb9f7208
Gerrit-Change-Number: 1401
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 24 Nov 2025 18:38:26 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH 1/1 Harden interactive service pipe
In reply to a message not in the archiveFrom: Selva Nair <[email protected]...>
- Append a version 4 uuid to ovpn_pipe_name to make it less predictable
- Do not allow remote access to the pipe
This greatly reduces the possibility of a rogue process racing to open the pipe before CreateFile() is called in the worker thread.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1401
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to release/2.6.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1401
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpnserv/interactive.c +21 -2
@@ -1955,11 +1955,30 @@ goto out; } +UUID pipe_uuid; +RPC_STATUS rpc_stat =UuidCreate (&pipe_uuid); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidCreate" ,1 , &exit_event); + goto out; + } + +RPC_WSTR pipe_uuid_str =NULL ; + rpc_stat =UuidToStringW (&pipe_uuid, &pipe_uuid_str); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidToString" ,1 , &exit_event); + goto out; + }openvpn_swprintf (ovpn_pipe_name,_countof (ovpn_pipe_name), -TEXT ("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu" ), service_instance,GetCurrentThreadId ()); +TEXT ("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu_%ls" ), service_instance, +GetCurrentThreadId (), pipe_uuid_str); +RpcStringFree (&pipe_uuid_str); + ovpn_pipe =CreateNamedPipe (ovpn_pipe_name,PIPE_ACCESS_DUPLEX |FILE_FLAG_FIRST_PIPE_INSTANCE |FILE_FLAG_OVERLAPPED , -PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT ,1 ,128 ,128 ,0 ,NULL ); +PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT |PIPE_REJECT_REMOTE_CLIENTS , +1 ,128 ,128 ,0 ,NULL );if (ovpn_pipe ==INVALID_HANDLE_VALUE ) {ReturnLastError (pipe,L"CreateNamedPipe" );
[Openvpn-devel] [PATCH applied] Re: Harden interactive service pipe
Thanks for the 2.6 backport.
This is basically identical to commit 05d0808ee65 in master, except that the 2.6 code is dealing with text strings differently (TEXT() vs. L(), and I felt that this is beyond what I should touch on cherrypicking bugfixes).
Compile-tested by BB and on MinGW/Ubuntu 24.04.
Your patch has been applied to the release/2.6 branch.
commit a8fb9f6443cd4ce3b76b1a31738ede2db5bc45ea (release/2.6)
Author: Selva Nair Date: Mon Nov 24 19:38:34 2025 +0100
Harden interactive service pipe
Signed-off-by: Selva Nair <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1401
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34654.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1401?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: Harden interactive service pipe
......................................................................
Harden interactive service pipe
- Append a version 4 uuid to ovpn_pipe_name to make it less predictable
- Do not allow remote access to the pipe
This greatly reduces the possibility of a rogue process racing to open the pipe before CreateFile() is called in the worker thread.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1401
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34654.html
---
M src/openvpnserv/interactive.c
1 file changed, 21 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/01/1401/2
src/openvpnserv/interactive.c +21 -2
@@ -1955,11 +1955,30 @@ goto out; } +UUID pipe_uuid; +RPC_STATUS rpc_stat =UuidCreate (&pipe_uuid); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidCreate" ,1 , &exit_event); + goto out; + } + +RPC_WSTR pipe_uuid_str =NULL ; + rpc_stat =UuidToStringW (&pipe_uuid, &pipe_uuid_str); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidToString" ,1 , &exit_event); + goto out; + }openvpn_swprintf (ovpn_pipe_name,_countof (ovpn_pipe_name), -TEXT ("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu" ), service_instance,GetCurrentThreadId ()); +TEXT ("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu_%ls" ), service_instance, +GetCurrentThreadId (), pipe_uuid_str); +RpcStringFree (&pipe_uuid_str); + ovpn_pipe =CreateNamedPipe (ovpn_pipe_name,PIPE_ACCESS_DUPLEX |FILE_FLAG_FIRST_PIPE_INSTANCE |FILE_FLAG_OVERLAPPED , -PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT ,1 ,128 ,128 ,0 ,NULL ); +PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT |PIPE_REJECT_REMOTE_CLIENTS , +1 ,128 ,128 ,0 ,NULL );if (ovpn_pipe ==INVALID_HANDLE_VALUE ) {ReturnLastError (pipe,L"CreateNamedPipe" );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1401?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: Ie66a142751354e421d48b273784fc79bcb9f7208
Gerrit-Change-Number: 1401
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1401?usp=email )
Change subject: Harden interactive service pipe
......................................................................
Harden interactive service pipe
- Append a version 4 uuid to ovpn_pipe_name to make it less predictable
- Do not allow remote access to the pipe
This greatly reduces the possibility of a rogue process racing to open the pipe before CreateFile() is called in the worker thread.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1401
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34654.html
---
M src/openvpnserv/interactive.c
1 file changed, 21 insertions(+), 2 deletions(-)
src/openvpnserv/interactive.c +21 -2
@@ -1955,11 +1955,30 @@ goto out; } +UUID pipe_uuid; +RPC_STATUS rpc_stat =UuidCreate (&pipe_uuid); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidCreate" ,1 , &exit_event); + goto out; + } + +RPC_WSTR pipe_uuid_str =NULL ; + rpc_stat =UuidToStringW (&pipe_uuid, &pipe_uuid_str); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidToString" ,1 , &exit_event); + goto out; + }openvpn_swprintf (ovpn_pipe_name,_countof (ovpn_pipe_name), -TEXT ("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu" ), service_instance,GetCurrentThreadId ()); +TEXT ("\\\\.\\pipe\\" PACKAGE "%ls\\service_%lu_%ls" ), service_instance, +GetCurrentThreadId (), pipe_uuid_str); +RpcStringFree (&pipe_uuid_str); + ovpn_pipe =CreateNamedPipe (ovpn_pipe_name,PIPE_ACCESS_DUPLEX |FILE_FLAG_FIRST_PIPE_INSTANCE |FILE_FLAG_OVERLAPPED , -PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT ,1 ,128 ,128 ,0 ,NULL ); +PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT |PIPE_REJECT_REMOTE_CLIENTS , +1 ,128 ,128 ,0 ,NULL );if (ovpn_pipe ==INVALID_HANDLE_VALUE ) {ReturnLastError (pipe,L"CreateNamedPipe" );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1401?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: Ie66a142751354e421d48b273784fc79bcb9f7208
Gerrit-Change-Number: 1401
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>